#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=1e5+7;
int num[N];
int dp[N];
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>num[i];
        dp[num[i]]++;
    }
    int id=1,now=0;
    while(dp[id]==0) id++;
    now=dp[id];
    for(int i=id+1;i<=1e5;i++)
    {
        if(dp[i]==0) continue;
        int nows=now;
        if(now>=dp[i])
        {
            dp[i]=0;
            now-=dp[i];
        }
        else
        {
            nows=dp[i];
            dp[i]-=now;
            now=nows;
        }
        id=i;
    }
    ll ans=0;
    for(int i=1;i<=1e5;i++)
        ans+=dp[i];
    cout<<ans;
    return 0;
}
